package com.example.countdowntimer;

import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.SystemClock;
import android.text.method.DateTimeKeyListener;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Chronometer;
import android.widget.TextView;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class MainActivity extends AppCompatActivity {

    private CountDownTimerView countDownTimerView;

    @RequiresApi(api = Build.VERSION_CODES.N)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button start = findViewById(R.id.button);
        Button stop = findViewById(R.id.button2);

//        CountDownTimer countDownTimer=new CountDownTimer(10*1000,500) {
//            @Override
//            public void onTick(long millisUntilFinished) {
//                textView.setText("" + (millisUntilFinished/1000));
//
//            }
//
//            @Override
//            public void onFinish() {
//
//            }
//        }.start();

        countDownTimerView = findViewById(R.id.my_timer);
        countDownTimerView.init(1000*60*60*2,50);
    }

    public void start(View view) {
        if(countDownTimerView != null){
            countDownTimerView.start();
        }
    }

    public void stop(View view) {
        if(countDownTimerView != null){
            countDownTimerView.stop();
        }
    }

}